package com.ygl.strategy.configuration;

import com.ygl.strategy.matcher.DiscoveryAntPathMatcherStrategy;
import com.ygl.strategy.matcher.DiscoveryMatcherStrategy;
import com.ygl.strategy.wrapper.StrategyWrapper;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * author: yanggld
 * date: 2019/12/21 22:02
 * version: 1.0
 * description: StrategyAutoConfiguration
 */
@Configuration
@RibbonClients(defaultConfiguration = { StrategyLoadBalanceConfiguration.class })
public class StrategyAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public DiscoveryMatcherStrategy discoveryMatcherStrategy() {
        return new DiscoveryAntPathMatcherStrategy();
    }


    @Bean
    public StrategyWrapper strategyWrapper() {
        return new StrategyWrapper();
    }
}
